public class PLLearnUtils {

	public static float GetWinnerMultiplicationFactor(){ return 1f;}
	public static float GetLoserMultiplicationFactor(){ return 0.5f;}

	// returns a multiplication factor to update a learners weight given its confidence 	
	public static float GetMultiplicationFactor(float confidence) {
		float factor = 1;

		// the confidence is low, reduce the weight of the expert 
		if (confidence < 0.5) {
			factor = 1/(1 + (0.5f -confidence) * 2);		
		} else {
			factor = 1 + (confidence -0.5f);
			//factor = (1 + (confidence -0.5f) * 2);	
		}
		
		return factor;
	}
	
	// utility function to updates the distribution based on the winner
	public static void UpdateDistForWinner(PLDist dist, int index) {
		if (index < 0  || index >= dist.GetSize()) {
			PLDebug.Warn("Invalid Index %d", index);
			return;
		}

		for (int i = 0; i < dist.GetSize(); ++i) {
			if (i == index) {
				dist.MultiplyValueAt(i, GetWinnerMultiplicationFactor());
			} else {
				dist.MultiplyValueAt(i, GetLoserMultiplicationFactor());			
			}
		}
	}
}




